﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="pages_TextMessage_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link type="text/css" href="../../css/tables.css" rel=Stylesheet />
    <link type="text/css" href="../../css/paging.css" rel=Stylesheet />
    <link type="text/css" href="../../css/home.css" rel=Stylesheet />
</head>
<body style="padding:25px">
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="ddContact" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddContact_SelectedIndexChanged" />
        <asp:DropDownList ID="ddNumber" runat="server" AutoPostBack="true" Visible="false" OnSelectedIndexChanged="ddNumber_SelectedIndexChanged" />
        
        &nbsp;
        <asp:Button ID="btnFormat" runat="server" Text="Format" OnClick="btnFormat_Click" Font-Size="Smaller" />
        &nbsp;
        <asp:Button ID="btnExport" runat="server" Text="Export" OnClick="btnExport_Click" Font-Size="Smaller" />
    </div>

        <asp:DataGrid id="dg" runat="server" AutoGenerateColumns="false" CssClass="datagrid"  EnableViewState="false" Width="1200" OnItemDataBound="dg_ItemDataBound">
            <HeaderStyle CssClass="th" BackColor="#666666" />
            <ItemStyle VerticalAlign="Top" Font-Size="Smaller" />
            <Columns>

                <asp:TemplateColumn HeaderText="Date">
                    <ItemStyle Wrap="false" />
                    <ItemTemplate >
                        <a href='default.aspx?id=<%# Eval("Message")%>' >
                            <%# Convert.ToDateTime(Eval("Date")).ToString("d-MMM-yy h:m:s tt")  %>
                        </a>
                    </ItemTemplate>
                </asp:TemplateColumn>

                <asp:BoundColumn HeaderText="To" DataField="FromTo" ItemStyle-Wrap="false"  />

                <asp:TemplateColumn HeaderText="Message" HeaderStyle-Width="100%">
                    <ItemStyle Width="100%" Font-Size="Larger" Font-Names="sans-serif" Font-Bold="true" />
                    <ItemTemplate>
                        <%# HttpUtility.HtmlEncode((string)Eval("Body")).Replace("\r\n", "\r\n<br/>") %>
                    </ItemTemplate>
                </asp:TemplateColumn>

                <asp:TemplateColumn HeaderText="Contact">
                    <ItemStyle  />
                    <ItemTemplate>
                        <%# HttpUtility.HtmlEncode((string)Eval("Addresses")).Replace(",", "\r\n<br/>") %><Br />
                        
                        <%# HttpUtility.HtmlEncode((string)Eval("ContactName")).Replace(",", "\r\n<br/>") %>
                    </ItemTemplate>
                </asp:TemplateColumn>

            </Columns>
        </asp:DataGrid>

        <uc:Paging ID="ctrlPaging" runat="server" PageSize="100"  />
    </form>
</body>
</html>
